<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>组管理</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 系统管理 <span class="c-gray en">&gt;</span> 组管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container" id="app">
	<a href="javascript:;" onclick="member_add('添加组','authinfo-group-add.html','','510')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加组</a></span></div>
	<div class="mt-20">
	<table id="list" class="table table-border table-bordered table-hover table-bg table-sort">
	</table>
	</div>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="js/jquery.base64.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="js/vue.js" charset="utf-8"></script>
<script type="text/javascript">
/*组-添加*/
function member_add(title,url,w,h){
	layer_show(title,url,w,h);
}
/*组-查看*/
function member_show(title,url,id,w,h){
	layer_show(title,url,w,h);
}
/*组-编辑*/
function member_edit(title,url,id,w,h){
	layer_show(title,url + "?id=" + id,w,h);
}
</script> 
<script type="text/javascript">
	var vm = new Vue({
		el : "#app",
		data : {
			msg : ""
		},
		//在实例初始化之后，数据观测 (data observer) 和 event/watcher 事件配置之前被调用。
		beforeCreate:function(){
			console.log('beforeCreate');
		},
		/* 在实例创建完成后被立即调用。
		在这一步，实例已完成以下的配置：数据观测 (data observer)，属性和方法的运算，watch/event 事件回调。
		然而，挂载阶段还没开始，$el 属性目前不可见。 */
		created	:function(){
			console.log('created');
		},
		//在挂载开始之前被调用：相关的渲染函数首次被调用
		beforeMount : function(){
			console.log('beforeMount');
	
		},
		//el 被新创建的 vm.$el 替换, 挂在成功	
		mounted : function(){
			console.log('mounted');
		
		},
		//数据更新时调用
		beforeUpdate : function(){
			console.log('beforeUpdate');
				
		},
		//组件 DOM 已经更新, 组件更新完毕 
		updated : function(){
			console.log('updated');
				
		},
		methods: { }
	});
	
	var table = $('#list').dataTable({
		"bProcessing" : true, //DataTables载入数据时，是否显示‘进度’提示  
		"bAutoWidth" : true, //是否自适应宽度  
		//stateSave: true,
		"lengthMenu":[10, 50, 100],
		"pageLength": 100,
		"aaSorting": [[ 1, "asc" ]],//默认第几个排序
		"aoColumnDefs": [
			{"orderable":false,"aTargets":[2]}// 制定列不参与排序
		],
		bDeferRender: true, 
		"aoColumns" : [{  
			"mDataProp" : "id",  
			"sTitle" : "ID",  
			"sDefaultContent" : "",  
			"sClass" : "center"  
		}, {  
			"mDataProp" : "groupName",  
			"sTitle" : "组名",  
			"sDefaultContent" : "",  
			"sClass" : "center"  
		}, { 
			"mDataProp" : "",  
			"sTitle" : "操作",  
			"sDefaultContent" : "",  
			"sClass" : "center"  
		}],
		"fnRowCallback" : function(nRow, aData, iDisplayIndex) {  
			/* 用来改写组权限的 */  
			console.log(aData);
			$('td:eq(2)', nRow).addClass('td-manage');
			var operations = '';
			var op_edit = "<a title=\"编辑\" href=\"javascript:;\" onclick=\"member_edit('编辑','authinfo-group-update.html','" + aData.id + "','','510')\" class=\"ml-5\" style=\"text-decoration:none\"><i class=\"Hui-iconfont\">&#xe6df;</i></a>";
			// var op_del = "<a title=\"删除\" href=\"javascript:;\" onclick=\"member_del(this,'" + aData.id + "')\" class=\"ml-5\" style=\"text-decoration:none\"><i class=\"Hui-iconfont\">&#xe6e2;</i></a>";
			if(hasRole("ADMIN")) {
				operations = operations + op_edit;
			}
			$('td:eq(2)', nRow).html(operations);
			return nRow;  
		},
		"sAjaxSource" : "apis/auth/groups/getTableList",
		// "sAjaxSource" : "http://localhost:8080/auth/groups/getTableList",
		//服务器端，数据回调处理  
		"fnServerData" : function(sSource, aDataSet, fnCallback) {  
			console.log(aDataSet);
			$.ajax({  
				"dataType" : 'json',  
				"type" : "GET",  
				"url" : sSource,  
				"data" : aDataSet,  
				"beforeSend": function (request) {
					request.setRequestHeader("Authorization", "Bearer " + getToken());
				},
				"success" : fnCallback ,
				"error" : function (request, msg, obj) {
					console.log(request);
					console.log(msg);
					console.log(obj);
					var respTxtObj = JSON.parse(request.responseText);
					console.log(respTxtObj);
				}
			});  
		}  
	});
</script>
</body>
</html>